<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>钱包盒子-完善信息</title>
		<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
		<link rel="stylesheet" href="../Public/css/Home/mui.css" />
		<link rel="stylesheet" href="../Public/css/Home/public.css" />
		<link rel="stylesheet" href="../Public/css/Home/post-form.css" />
	</head>

	<body class="bg-white">
		<header class="mui-bar mui-bar-nav">
			<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
			<h1 class="mui-title">完善信息</h1>
		</header>
		<div class="mui-content mui-scroll-wrapper bg-white">
			<div class="mui-scroll">
				<div class="post-form">

					<div class="mb-head">
						<div class="tit">欢迎来到现金贷</div>
						<p class="text">为保障你的账户安全，请使用<span class="c-blue">本人身份证</span>完成身份认证</p>
					</div>

					<h5 class="subtitle fc3-2"><span class="num">1</span>请填写您的职业身份</h5>
					<input type="hidden" name="vocation" id="vocation" value="我是上班族" />
					<ul id="vocationList" class="mui-table-view-radio mb-radio clearfix">
						<li class="mui-table-view-cell mui-selected">
							<div class="btn">我是上班族</div>
						</li>
						<li class="mui-table-view-cell">
							<div class="btn">我是个体户</div>
						</li>
					</ul>

					<h5 class="subtitle fc3-2"><span class="num">2</span>请填写您的信用资质</h5>
					<input type="hidden" name="aptitude" id="aptitude" value="已有信用卡" />
					<ul id="aptitudeList" class="mui-table-view-radio mb-radio clearfix">
						<li class="mui-table-view-cell mui-selected">
							<div class="btn">已有信用卡</div>
						</li>
						<li class="mui-table-view-cell">
							<div class="btn">暂无信用卡</div>
						</li>
					</ul>

					<h5 class="subtitle fc3-2"><span class="num">2</span>请填写您的信用资质</h5>
					<div class="identity-card layout-box">
						<div class="input-box name">
							<input id="realName" type="text" placeholder="姓名">
						</div>
						<span class="text">+</span>
						<div class="input-box flex-item1">
							<input id="idcard" type="text" placeholder="请输入您的身份证">
						</div>
					</div>

					<div class="note">注: 主人,请留下您的个人信息,方便及时为您服务</div>

					<button id="sendBtn" class="mui-btn mui-btn-block send-btn" type="button">立即借款</button>

				</div>

			</div>
		</div>
	</body>
	<script src="../Public/js/Home/jquery.min.js" type="text/javascript" charset="utf-8"></script>
	<script src="../Public/js/Home/mui.js" type="text/javascript" charset="utf-8"></script>
	<script src="../Public/js/Home/common.js" type="text/javascript" charset="utf-8"></script>
	<script type="text/javascript">
		var money,cycle,purpose,repayment,type;
		mui.init();
		
		mui('.mui-scroll-wrapper').scroll({
			deceleration: 0.0005
		});

		$(function() {
			
			money = common.getLocVal("money");
			type = common.getLocVal("type");
			cycle = common.getLocVal("cycle");
			purpose = common.getLocVal("purpose");
			repayment = common.getLocVal("repayment");
		});
		
		document.getElementById("vocationList").addEventListener('selected',function(e){
			document.getElementById("vocation").value = e.detail.el.innerText;
		});
		
		document.getElementById("aptitudeList").addEventListener('selected',function(e){
			document.getElementById("aptitude").value = e.detail.el.innerText;
		});
		
		document.getElementById("sendBtn").addEventListener('tap', function() {
			var vocation = document.getElementById("vocation").value;
			var aptitude = document.getElementById("aptitude").value;
			var real_name = document.getElementById("realName").value;
			var idcard = document.getElementById("idcard").value; 
			if(!real_name) {
				common.alert("提示", "请输入您的真实姓名!");
				return false;
			}
			if(!idcard) {
				common.alert("提示", "请输入您的身份证号!");
				return false;
			}
			
			var params = {
				url: 'Borrow/save',
				data: {
					money: parseInt(money),
					vocation: vocation,
					aptitude: aptitude,
					real_name: real_name,
					cycle: cycle,
					repayment: repayment,
					idcard: idcard,
					type: parseInt(type)
				}
			}
			common.loading("正在提交...请稍后...");
			common.JsonPost(params, function(data) {
				common.closeLoading();
                                common.clearLocVal("money");
                                common.clearLocVal("cycle");
                                common.clearLocVal("purpose");
                                common.clearLocVal("repayment");
                                common.clearLocVal("type");
				common.alert("提示", "提交成功!");
				console.log(JSON.stringify(data));
			})
		});

	</script>

</html>